<?php
//Define css & javascript file
$baseUrl  = Yii::app()->baseUrl;
$register = Yii::app()->getClientScript();
$register->registerCssFile($baseUrl . '/css/treeview/jquery.treeview.css');
$register->registerScriptFile($baseUrl . '/js/jquery.treeview.js');
?>

<div class="column-content-box" style="margin:0; font-size: 1.5em;">
    <div class="content-box content-box-header ui-corner-all">
        <div class="content-box-wrapper">
            <ul id="treeview">
                <?php
                $this->widget('ArrayToList', array(
                    'data'     => $model->getMenu(true),
                    'parentId' => 2, //childs of News
                ));
                ?>
            </ul>
        </div>
    </div>
</div>

<div class="clearfix"></div>

<script type="text/javascript">
//Menu tree (parent)
$('#treeview').treeview({
    collapsed: false,
    animated: "medium",
    unique: true
});

$(document).on("click", ".link", function(){
    var prefix = 'news/cat/';
    var titleSeo = $(this).convertSeoStr({separator: '-'});
    var link = prefix + titleSeo;

    parent.$('#dialogLinks')
        .data('link', link)
        .trigger('assignLink')
        .dialog('close');
});
</script>